package com.daniel.other;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description list如何判空,list.isEmpty()等效于list.size() != 0
 * @Author GanShaoXi
 * @ClassName List_001
 * @Return com.daniel.other
 * @Since 1.0.0
 * @Created on 2023/5/16 19:54
 */
public class List_001 {
    public static void test(List list) {
        System.out.println("list!=null&&list.isEmpty() = " + (list != null && !list.isEmpty()));
        System.out.println("list!=null&&list.isEmpty() = " + (list != null && list.size() != 0));
    }
}

class Test {

    public static void main(String[] args) {
        List list1 = new ArrayList<>();
        list1.add(1);
        List<Object> list2 = null;
        List_001.test(list1);
        List_001.test(list2);

    }
}